//
// Created by wze-zero on 2024/10/25.
//
#include <iostream>

using namespace std;

int check(int num) {
    string s;
    int num1 = 0, num2 = 0;
    while (num % 2 || num / 2) {
        s += to_string(num % 2);
        num /= 2;
    }
    for (int i = 0; i < s.size(); ++i) {
        s.at(i) == '0' ? ++num1 : ++num2;
    }
    if (num1 % 2 == 0 && num2 % 2 != 0) {
        return 0;
    } else if (num1 % 2 != 0 && num2 % 2 == 0) {
        return 1;
    } else if (num1 % 2 == 0 && num2 % 2 == 0) {
        return 10;
    } else {
        return 100;
    }
}

int main() {
    int n, num;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> num;
        cout << check(num) << ' ';
    }
    return 0;
}